import Home from "@/pages/Home"
import Category from "@/pages/Category"
import Find from "@/pages/Find"
import Cart from "@/pages/Cart"
import Mine from "@/pages/Mine"
import CategoryList from "@/pages/CategoryList"
import Tabbar from "@/components/Tabbar"
import AppHeader from "@/components/AppHeader"

const routes = [{
    path: '/',
    redirect: '/home',
    meta: {
        isNav: false
    }
}, {
    path: '/home',
    name: 'home',
    components: { //复用组件
        header: AppHeader,
        main: Home,
        tabbar: Tabbar
    },
    meta: {
        navTitle: '首页',
        isNav: true
    }
}, {
    path: '/category',
    name: 'category',
    components: {
        main: Category,
        tabbar: Tabbar
    },
    meta: {
        navTitle: '分类',
        isNav: true
    },
    children: [{
        path: ":categoryId",
        name: "categorylist",
        components: {
            default: CategoryList
        }
    }]
}, {
    path: '/find',
    name: 'find',
    components: {
        main: Find,
        tabbar: Tabbar
    },
    meta: {
        navTitle: '发现',
        isNav: true
    }
}, {
    path: '/cart',
    name: 'cart',
    components: {
        main: Cart,
        tabbar: Tabbar
    },
    meta: {
        navTitle: '购物车',
        isNav: true
    }
}, {
    path: '/mine',
    name: 'mine',
    components: {
        main: Mine,
        tabbar: Tabbar
    },
    meta: {
        navTitle: '我的',
        isNav: true
    }
}]
export default routes;